package calcmaster.calculator.domain;

public enum FunctionType {
	DIV("div"),
	MOD("mod"),
	SIN("sin"),
	COS("cos"),
	TG("tg"),
	CTG("ctg"),
	ARCSIN("arcsin"),
	CARCCOS("arccos"),
	ARCTG("arctg"),
	ARCCTG("arcctg"),
	SINH("sinh"),
	COSH("cosh"),
	TGH("tgh"),
	CTGH("ctgh"),
	ARCSINH("arcsinh"),
	ARCCOSH("arccosh"),
	ARCTGH("arctgh"),
	ARCCTGH("arcctgh"),
	DTOR("dtor"),
	RTOD("rtod"),
	RTOG("rtog"),
	GTOR("gtor"),
	DTOG("dtog"),
	GTOD("gtod"),
	ABS("abs"),
	TRUNC("trunc"),
	ROUND("round"),
	FRAC("frac"),
	MAX("max"),
	MIN("min"),
	SQRT("sqrt"),
	FLOOR("floor"),
	CEIL("ceil"),
	LN("ln"),
	LG("lg"),
	LOG("log"),
	EXP("exp"),
	RAND("rand"),
	RANDOM("random"),
	RANDOMR("randomr");
	
	private String functionName;
	
	FunctionType(String functionName) {
		this.functionName = functionName;
	}
	
	String getFunctionName() {
		return this.functionName;
	}
	
	public static FunctionType getFromName(String functionName) {
		for (FunctionType functionType : values()) {
			if (functionType.getFunctionName().equals(functionName)) {
				return functionType;
			}
		}
		
		return null;
	}
	
}
